/*
 * @Author: Penk
 * @LastEditors: Penk
 * @LastEditTime: 2023-02-07 01:13:29
 * @FilePath: \autojs-tutorial\06-跳入抖音个人主页或者视频页.js
 * @email: 492934056@qq.com
 */

var a =1

function dumpUser(userId) {
  app.startActivity({
    action: "android.intent.action.VIEW",
    packageName: "com.ss.android.ugc.aweme",
    data: "snssdk2329://user/profile/" + userId,
    // root: true
  });
  return null
}

// 钟先生的抖音ID
// var userId='85094837512';
// 林小姐的ID
var userId = '3835513116037719';
dumpUser(userId);

/******* 
 * @author: Penk
 * @description: 跳转到指定的视频页
 * @param {*} detailId
 * @return {*}
 */
function dumpDetail(detailId) {
  app.startActivity({
    action: "android.intent.action.VIEW",
    packageName: "com.ss.android.ugc.aweme",
    data: "snssdk2329://aweme/detail/" + detailId,
    // root: true
  });
}

var detailId = '7134682892306861325';
dumpDetail(detailId);

// 想后台请求数据
// var res = http.get("http://192.168.31.66:3000/autojs/getTask", {
//   headers: {
//     'Accept-Language': 'zh-cn,zh;q=0.5',
//     'User-Agent': 'Mozilla/5.0(Macintosh;IntelMacOSX10_7_0)AppleWebKit/535.11(KHTML,likeGecko)Chrome/17.0.963.56Safari/535.11'
//   }
// });

// if (res.statusCode != 200) {
//   toast("请求失败: " + res.statusCode + " " + res.statusMessage);
// } else {
//   var body = res.body.json();
//   log(body.id);
// }